Skip to main content

All Questions

0votes
1answer
70views

How to properly access Pandas DataFrame generated from xarray Dataset

I have an xarray dataset created and converted to pandas like so: arr = xr.Dataset( coords={ "test1": range(20000,60000+1,2500), "test2": range(10, 100+1), ...
Caden's user avatar
-1votes
1answer
22views

ds_oneday_us.sel(lat=i,lon=j,method='nearest') -ISSUES with Dataframe

I have the following code: for i,j in zip(obs_lat,obs_lon): dsloc = ds_oneday_us.sel(lat=i,lon=j,method='nearest') dsloc_lat=dsloc.lat.to_pandas() dsloc_lon=dsloc.lon.to_pandas() ...
Ozlem Ozalp's user avatar
0votes
1answer
47views

Anonymously select data from Xarray

In pandas I can do something like - pd.read_csv(path).loc[lambda df: df.col > 10, cols] And I'm wondering if there's an equivalent in Xarray? I've tried - xr.open_dataset(path)["var"]....
thefrollickingnerd's user avatar
0votes
1answer
63views

Multiply xarray map by country specific values

I have one xarray dataset (da_main) with lat, lon dimensions and I want to multiply this dataset by another dataset that depend on the country (da_value_per_country). I also have a dataset giving me ...
bessrom's user avatar
2votes
1answer
48views

Constructing a NetCDF where variable consists of data and error data

Quite a simple question but I cannot seem to find a solution. I have time dimension, years t1 to t2. Then I have a few variables, lets say [x, y, z] and all of them have error values associated with ...
jugimanni's user avatar
1vote
1answer
447views

Xarray KeyError: the index is unsorted or non-unique

I have an Xarray, which contains Sentinel-2 satellite images. Based on this Stackstac example, I am trying to crop my AOI using loc: aoi = da.loc[..., y_utm + m_buffer:y_utm - m_buffer, x_utm - ...
James Cree's user avatar
1vote
1answer
687views

Is there a way to delete time values in an xarray dataset that does not meet a certain time value?

This ERA5 dataset, made up of netCDF files, comes in time values of %Y-%m-%dT%h:%M%s %p and they are given hourly. So, for 31 days, there are 744-time values. I only want to take the 12:00:00 value ...
Matthew Graber's user avatar
0votes
2answers
286views

I want to select data using ranges of longitudes and latitudes in a NetCDF4 file using Python on Windows. I can't even open the dataset with xarray

I hoped that converting it into a DataFrame would help. I had planned to use the between function on the resulting dataframe. But the conversion itself does not work, even with xarray. I have another ...
Jean-Victor Côté's user avatar
0votes
1answer
606views

Create a 3D xarray (lat,long and time) from a dataframe

I have a dataframe that has for each row a timestep, latitude, longitude and the values of the variables. So there exists a repetition of values since we have a row for each day and each latitude and ...
Cristina's user avatar
0votes
1answer
42views

Python Pandas - level exceeded % of time

I'm looking for a quick way to calculate a statistical value exceeded % of the time in a 3D matrix. I was looking at using python and pandas but as a newbie I can get my data using xarray in but can't ...
Always Learning's user avatar
1vote
1answer
537views

How to remove coordinates and corresponding arrays from variables that have 'nan' in xarray

I have an nc file "data1.nc" that plots like this: I performed masking over the data to remove ocean values, making a new nc file: "new.nc", in which, the ocean values are now 'nan'...
piyush's user avatar
1vote
1answer
159views

Merging series of 2D DataFrames to 3D xarray

I have a series of 2D DataFrames that should be merged into a 3D xarray. The structure of DataFrames looks like this: 5 6 4 8 -1 3 angle 5 105.87 459.62 0.1 10 211.74 919.24 0.1 5 6 4 8 -1 3 angle 5 ...
Anavae's user avatar
1vote
1answer
66views

Reading 3-dimensional data from many files

I have many text files with data written in such a structure: #ABTMTY mdjkls 993583.17355 ebgtas 899443.47380 udenhr 717515.59788 paomen 491385.80901 gneavc 275411.91025 ...
Anavae's user avatar
0votes
1answer
1kviews

Grib2 data extraction with xarray and cfgrib very slow, how to improve the code?

The code is taking about 20 minutes to load a month for each variable with 168 time steps for the cycle of 00 and 12 UTC of each day. When it comes to saving to csv, the code takes even longer, it's ...
William Jacondino's user avatar
0votes
1answer
112views

how to extract values based upon month in xarray

I have an array of dimensions (9131,101,191). The first dimension is the days from 1/1/2075 till 31/12/2099. I want to extract all the days which are in the month of July. How can I do this in xarray? ...
Sohaib's user avatar

153050per page
close